feat(ci): add trusted publisher release workflows for JS and Python SDKs#686
Open
Leechael wants to merge 3 commits into
Open
feat(ci): add trusted publisher release workflows for JS and Python SDKs#686Leechael wants to merge 3 commits into
Leechael wants to merge 3 commits into
Conversation
ebdad08 to
d0cc3c2
Compare
Add GitHub Actions workflows that publish to npm and PyPI using OIDC trusted publishers (no long-lived secrets). - js-sdk-release.yml: triggered by js-sdk-v* tags, publishes to npm with provenance. Includes npm upgrade, OIDC verification, and repository consistency checks. - python-sdk-release.yml: triggered by python-sdk-v* tags, builds with PDM and publishes via pypa/gh-action-pypi-publish. - Add repository field to sdk/js/package.json (required for npm Trusted Publishers / Sigstore provenance verification).
a6faf1f to
5032ce7
Compare
5032ce7 to
4520abf
Compare
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GitHub Actions release automation to publish the JS SDK to npm and the Python SDK to PyPI using OIDC trusted publishers (no long-lived registry tokens), plus small SDK metadata/config updates to support trusted publishing.
Changes:
- Introduces tag-triggered release workflows for publishing JS (
js-sdk-v*) to npm (with provenance) and Python (python-sdk-v*) to PyPI/TestPyPI. - Updates SDK versions and npm package metadata (
repository), and bumps TS compile targets to ES2020. - Adjusts JS env var encryption key import and adds Claude local settings files under
sdk/js/.claude/.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/python/pyproject.toml |
Bumps Python SDK version and minor formatting cleanup. |
sdk/js/tsconfig.json |
Raises TS compilation target to ES2020. |
sdk/js/tsconfig.node.json |
Raises Node TS compilation target to ES2020. |
sdk/js/tsconfig.browser.json |
Raises browser TS compilation target to ES2020 and trims whitespace. |
sdk/js/src/encrypt-env-vars.ts |
Tweaks WebCrypto key import input type for AES-GCM. |
sdk/js/package.json |
Bumps JS SDK version, adds repository metadata for npm trusted publishing, pins typescript. |
sdk/js/.claude/settings.local.json |
Adds Claude local permissions configuration (machine-local content). |
sdk/js/.claude/settings.local.json.license |
Adds license sidecar for the local Claude settings file. |
.github/workflows/python-sdk-release.yml |
New workflow to build (PDM) and publish Python SDK to PyPI/TestPyPI via OIDC. |
.github/workflows/js-sdk-release.yml |
New workflow to build and publish JS SDK to npm via OIDC + provenance and create a GitHub Release. |
Comments suppressed due to low confidence (3)
sdk/js/src/encrypt-env-vars.ts:55
- In Node.js, the
cryptomodule does not exposesubtle/getRandomValuesat the top level; those live undercrypto.webcrypto(orglobalThis.crypto). As written,crypto.subtlewill beundefinedat runtime and encryption will fail.
// Import shared key for AES-GCM
const importedShared = await crypto.subtle.importKey(
"raw",
new Uint8Array(shared),
{ name: "AES-GCM", length: 256 },
true,
["encrypt"],
);
// Encrypt the data
const iv = crypto.getRandomValues(new Uint8Array(12));
const encrypted = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
importedShared,
new TextEncoder().encode(envsJson),
);
sdk/js/src/encrypt-env-vars.ts:55
- In Node.js, the
cryptomodule does not exposesubtle/getRandomValuesat the top level; those live undercrypto.webcrypto(orglobalThis.crypto). As written,crypto.subtlewill beundefinedat runtime and encryption will fail.
// Import shared key for AES-GCM
const importedShared = await crypto.subtle.importKey(
"raw",
new Uint8Array(shared),
{ name: "AES-GCM", length: 256 },
true,
["encrypt"],
);
// Encrypt the data
const iv = crypto.getRandomValues(new Uint8Array(12));
const encrypted = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
importedShared,
new TextEncoder().encode(envsJson),
);
sdk/js/src/encrypt-env-vars.ts:55
- In Node.js, the
cryptomodule does not exposesubtle/getRandomValuesat the top level; those live undercrypto.webcrypto(orglobalThis.crypto). As written,crypto.subtlewill beundefinedat runtime and encryption will fail.
// Import shared key for AES-GCM
const importedShared = await crypto.subtle.importKey(
"raw",
new Uint8Array(shared),
{ name: "AES-GCM", length: 256 },
true,
["encrypt"],
);
// Encrypt the data
const iv = crypto.getRandomValues(new Uint8Array(12));
const encrypted = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
importedShared,
new TextEncoder().encode(envsJson),
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
5
| "target": "es2020", | ||
| "module": "commonjs", | ||
| "lib": ["es2018"], |
Comment on lines
+4
to
6
| "target": "es2020", | ||
| "module": "commonjs", | ||
| "lib": ["es2018"], |
Comment on lines
+4
to
6
| "target": "es2020", | ||
| "module": "es2015", | ||
| "lib": ["es2018", "dom"], |
Comment on lines
+1
to
+16
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(npm run clean:*)", | ||
| "Bash(npm run build:*)", | ||
| "Bash(npm test)", | ||
| "Bash(export DSTACK_SIMULATOR_ENDPOINT=/Users/leechael/workshop/phala/dstack/sdk/simulator/dstack.sock)", | ||
| "Bash(export TAPPD_SIMULATOR_ENDPOINT=/Users/leechael/workshop/phala/dstack/sdk/simulator/tappd.sock)", | ||
| "Bash(node:*)", | ||
| "Bash(rm:*)", | ||
| "Bash(npm run test:ci:*)", | ||
| "Bash(grep:*)", | ||
| "Bash(npm test:*)", | ||
| "Bash(npm install)", | ||
| "Bash(npm run test:*)", | ||
| "Bash(npx tsc:*)" |
Comment on lines
+1
to
+3
| SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network> | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 |
Comment on lines
+1
to
+5
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(npm run clean:*)", | ||
| "Bash(npm run build:*)", |
Comment on lines
+1
to
+3
| SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network> | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 |
Comment on lines
+76
to
+88
| run: | | ||
| VERSION="${GITHUB_REF_NAME#js-sdk-v}" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "tag=${{ github.event.inputs.npm_tag }}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| # auto-detect from git tag: js-sdk-v0.5.8-beta.1 -> beta | ||
| if echo "$VERSION" | grep -qiE '(beta|alpha|rc|preview)'; then | ||
| echo "tag=beta" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "tag=latest" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| fi |
Comment on lines
+36
to
+39
| - name: Upgrade npm for OIDC support | ||
| run: | | ||
| npm install -g npm@latest | ||
| echo "npm version: $(npm --version)" |
Comment on lines
+41
to
+43
| - name: Parse version | ||
| id: version | ||
| run: echo "version=${GITHUB_REF_NAME#python-sdk-v}" >> "$GITHUB_OUTPUT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GitHub Actions workflows that publish to npm and PyPI using OIDC trusted publishers (no long-lived secrets).
js-sdk-release.yml): triggered byjs-sdk-v*tags, publishes to npm with provenance. Includes npm upgrade, OIDC verification, and repository consistency checks.python-sdk-release.yml): triggered bypython-sdk-v*tags, builds with PDM and publishes viapypa/gh-action-pypi-publish.repositoryfield tosdk/js/package.json— required for npm Trusted Publishers / Sigstore provenance verification.Registry configuration needed before first publish
Dstack-TEE, Repositorydstack, Workflowjs-sdk-release.yml.Dstack-TEE, Repositorydstack, Workflowpython-sdk-release.yml.